package autoevony.common 
{
    public dynamic class ObjectExt extends Object
    {
        public function ObjectExt(arg1:XML)
        {
            var loc2:*=null;
            var loc5:*=null;
            var loc6:*=null;
            var loc7:*=null;
            var loc8:*=null;
            var loc9:*=0;
            super();
            var loc1:*=arg1.attributes();
            var loc10:*=0;
            var loc11:*=loc1;
            for each (loc2 in loc11) 
            {
                this["@" + loc2.name()] = loc2.toString();
            }
            if (arg1.hasSimpleContent()) 
            {
                this["data"] = arg1.toString();
                return;
            }
            var loc3:*=arg1.children();
            var loc4:*=new Object();
            loc10 = 0;
            loc11 = loc3;
            for each (loc5 in loc11) 
            {
                loc6 = loc5.name().toString();
                if (loc4[loc6] != undefined) 
                {
                    continue;
                }
                loc4[loc6] = loc6;
                if ((loc7 = arg1.child(loc6)).length() == 1) 
                {
                    this[loc6] = new autoevony.common.ObjectExt(XML(loc7));
                    continue;
                }
                loc8 = new Array();
                this[loc6] = loc8;
                loc9 = 0;
                var loc12:*=0;
                var loc13:*=loc7;
                for each (loc5 in loc13) 
                {
                    var loc14:*;
                    loc8[loc14 = loc9++] = new autoevony.common.ObjectExt(loc5);
                }
            }
            return;
        }

        public function toDebugString(arg1:String=""):String
        {
            var loc2:*=null;
            var loc3:*=0;
            var loc1:*="";
            var loc4:*=0;
            var loc5:*=this;
            for (loc2 in loc5) 
            {
                if (loc1 != "") 
                {
                    loc1 = loc1 + irrcrpt("\n", 2);
                }
                if (this[loc2] is Array) 
                {
                    loc3 = 0;
                    while (loc3 < this[loc2].length) 
                    {
                        if (loc3 != 0) 
                        {
                            loc1 = loc1 + irrcrpt("\n", 2);
                        }
                        loc1 = loc1 + this[loc2][loc3].toDebugString(arg1 + "." + loc2 + "[" + loc3 + "]");
                        ++loc3;
                    }
                    continue;
                }
                if (this[loc2] is ObjectExt) 
                {
                    loc1 = loc1 + this[loc2].toDebugString(arg1 + "." + loc2);
                    continue;
                }
                loc1 = loc1 + (arg1 + "." + loc2 + irrcrpt(" = ", 3) + this[loc2]);
            }
            return loc1;
        }
    }
}
